17. Quiz: Type and Type Conversion

Quiz: What Type Do These Objects Have?

Which Type? I

What type does this object have? "12". There is a coding environment further down this page that you can use for experimentation. Enter your code and run it with the "Test Run" button.

SOLUTION: str

Which Type? II

What type does this object have? 12.3 There is a coding environment further down this page that you can use for experimentation. Enter your code and run it with the "Test Run" button.

SOLUTION: float

Which Type? III

What type does this object have? len("my_string") There is a coding environment further down this page that you can use for experimentation. Enter your code and run it with the "Test Run" button.

SOLUTION: int

Which Type? IV

What type does this object have? "hippo" *12 There is a coding environment further down this page that you can use for experimentation. Enter your code and run it with the "Test Run" button.

SOLUTION: str

Type Playground

Use this programming space with Test Run to experiment with types of objects. Don't forget to use print to see the output of your code.

Start Quiz:

Quiz: Total Sales

In this quiz, you’ll need to change the types of the input and output data in order to get the result you want.

Calculate and print the total sales for the week from the data provided. Print out a string of the form "This week's total sales: xxx", where xxx will be the actual total of all the numbers. You’ll need to change the type of the input data in order to calculate that total.

Start Quiz:

mon_sales = "121"
tues_sales = "105"
wed_sales = "110"
thurs_sales = "98"
fri_sales = "95"

#TODO: Print a string with this format: This week's total sales: xxx
# You will probably need to write some lines of code before the print statement.